-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix potential IllegalCapacityException in LLRC when selecting nodes #37821
Conversation
Hi @SivagurunathanV, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change itself looks like the solution proposed in #37739, so that part looks fine. It would be good to have some sort of test though that checks this behaviour. It looks like it should be easy to unit-test RestClient#selectNodes even though it is package-private. There is already a RestClientTests that should be a good place for this.
Pinging @elastic/es-core-features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @cbuescher mentioned, do you think you could add a unit test for this @SivagurunathanV?
@@ -398,7 +398,7 @@ private void setHeaders(HttpRequest httpRequest, Collection<Header> requestHeade | |||
/* | |||
* Sort the nodes into living and dead lists. | |||
*/ | |||
List<Node> livingNodes = new ArrayList<>(nodeTuple.nodes.size() - blacklist.size()); | |||
List<Node> livingNodes = new ArrayList<>(Math.max(0,nodeTuple.nodes.size() - blacklist.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor nit, could you add a space after the comma?
List<Node> livingNodes = new ArrayList<>(Math.max(0,nodeTuple.nodes.size() - blacklist.size())); | |
List<Node> livingNodes = new ArrayList<>(Math.max(0, nodeTuple.nodes.size() - blacklist.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
3bb5e22
to
b5625fd
Compare
Added test case. |
@elasticmachine ok to test |
Hi @dakrone "org.elasticsearch.transport.ConnectTransportException: [node_sm1][127.0.0.1:37453] connect_exception I would appreciate if can you help to debug on this or any point of reference? Thanks, |
@dakrone @cbuescher |
Merged this, thanks for working through this @SivagurunathanV! |
Thanks @dakrone & @cbuescher for guiding me in my first PR 👍. Cheers. |
* elastic/master: (68 commits) Fix potential IllegalCapacityException in LLRC when selecting nodes (elastic#37821) Mute CcrRepositoryIT#testFollowerMappingIsUpdated Fix S3 Repository ITs When Docker is not Available (elastic#37878) Pass distribution type through to docs tests (elastic#37885) Mute SharedClusterSnapshotRestoreIT#testSnapshotCanceledOnRemovedShard SQL: Fix casting from date to numeric type to use millis (elastic#37869) Migrate o.e.i.r.RecoveryState to Writeable (elastic#37380) ML: removing unnecessary upgrade code (elastic#37879) Relax cluster metadata version check (elastic#37834) Mute TransformIntegrationTests#testSearchTransform Refactored GeoHashGrid unit tests (elastic#37832) Fixes for a few randomized agg tests that fail hasValue() checks Geo: replace intermediate geo objects with libs/geo (elastic#37721) Remove NOREPLACE for /etc/elasticsearch in rpm and deb (elastic#37839) Remove "reinstall" packaging tests (elastic#37851) Add unit tests for ShardStateAction's ShardStartedClusterStateTaskExecutor (elastic#37756) Exit batch files explictly using ERRORLEVEL (elastic#29583) TransportUnfollowAction should increase settings version (elastic#37859) AsyncTwoPhaseIndexerTests race condition fixed (elastic#37830) Do not allow negative variances (elastic#37384) ...
Handling LLRC when live node size < 0